package com.wangshouyu.mp.qrcode;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
import com.wangshouyu.mp.base.response.BaseResponse;

import java.util.Objects;

/**
 * @author 王守钰
 * @date 2021年01月23日 13:39
 * @description 二维码ticket
 */
public class QrCodeResponse extends BaseResponse {

    /**
     * 凭证
     */
    private String ticket;

    /**
     * 有效时间
     */
    @SerializedName(value = "expire_seconds")
    @JsonProperty(value = "expire_seconds")
    @JSONField(name = "expire_seconds")
    private Long expireSeconds;

    /**
     * 地址
     */
    private String url;

    public String getTicket() {
        return ticket;
    }

    public void setTicket(String ticket) {
        this.ticket = ticket;
    }

    public Long getExpireSeconds() {
        return expireSeconds;
    }

    public void setExpireSeconds(Long expireSeconds) {
        this.expireSeconds = expireSeconds;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        QrCodeResponse that = (QrCodeResponse) o;
        return Objects.equals(ticket, that.ticket) && Objects.equals(expireSeconds, that.expireSeconds) && Objects.equals(url, that.url);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), ticket, expireSeconds, url);
    }

    @Override
    public String toString() {
        return "QrCodeResponse{" +
                "ticket='" + ticket + '\'' +
                ", expireSeconds=" + expireSeconds +
                ", url='" + url + '\'' +
                '}';
    }
}
